import { requestUrl } from '@/common/utils.js'
import { BASE_URL } from '@/api/config.js'

/**
 * @function 字典数据
 * @param params
 * @returns
 */
export function combo(params) {
  return requestUrl({
    url: `${BASE_URL}/standardCodeList/combo`,
    data: params,
    method: 'get'
  })
}

/**
 * @function 地区树数据接口
 * @param params
 * @returns
 */
export function findAllTreeInfoList(params) {
  return requestUrl({
    url: `${BASE_URL}/allTreeInfo/findAllTreeInfoList`,
    data: params,
    header: {
      App_type: 1
    },
    method: 'POST'
  })
}

/**
 * @function 登录
 * @param params
 * @returns
 */
export function login(params) {
  return requestUrl({
    url: `${BASE_URL}/weChatInfo/loginByOperatorPhoneNo`,
    data: params,
    method: 'POST'
  })
}

/**
 * @function 获取用户信息
 * @param params
 * @returns
 */
export function getOperatorInfo(params) {
  return requestUrl({
    url: `${BASE_URL}/weChatInfo/getOperatorInfo`,
    data: params,
    method: 'get'
  })
}

/**
 * @function 获取统计数据
 * @param params
 * @returns
 */
export function workOrderStatisticsByOperatorId(params) {
  return requestUrl({
    url: `${BASE_URL}/weChatInfo/workOrderStatisticsByOperatorId`,
    data: params,
    method: 'get'
  })
}

/**
 * @function 获取安装设备工单列表
 * @param params
 * @returns
 */
export function geInstallOrderListByOperator(params) {
  return requestUrl({
    url: `${BASE_URL}/weChatInfo/geInstallOrderListByOperator`,
    data: params,
    method: 'POST'
  })
}

/**
 * @function 暂存安装工单或提交(完成安装)
 * @param params
 * @returns
 */
export function saveInstallWorkOrder(params) {
  return requestUrl({
    url: `${BASE_URL}/weChatInfo/installStagingSaveWorkOrder`,
    data: params,
    method: 'POST'
  })
}

/**
 * @function 根据用户手机号获取用户信息
 * @param params
 * @returns
 */
export function getUserInfoByPhoneNo(params) {
  return requestUrl({
    url: `${BASE_URL}/weChatInfo/getUserInfoByPhoneNo`,
    data: params,
    method: 'GET'
  })
}

/**
 * @function 根据设备编码获取设备信息
 * @param params
 * @returns
 */
export function getDeviceInfoByDeviceCode(params) {
  return requestUrl({
    url: `${BASE_URL}/weChatInfo/getDeviceInfoByDeviceCode`,
    data: params,
    method: 'GET'
  })
}

/**
 * @function 根据设备IMIE获取设备信息
 * @param params
 * @returns
 */
export function getDeviceInfoByDeviceImie(params) {
  return requestUrl({
    url: `${BASE_URL}/weChatInfo/getDeviceInfoByIMEI`,
    data: params,
    method: 'GET'
  })
}


export function getDeviceInfo(searchValue) {
  return requestUrl({
    url: `${BASE_URL}/weChatInfo/getDeviceInfo?info=${searchValue}`,
    method: 'GET'
  })
}



/**
 * @function 根据设备编码获取设备信息
 * @param params
 * @returns
 */
export function findValveList(params) {
  return requestUrl({
    url: `${BASE_URL}/deviceAssertsInfo/findList`,
    data: params,
    method: 'POST'
  })
}

/******************************维修工单*************************************/
/**
 * @function 获取维修设备工单列表
 * @param params
 * @returns
 */
export function getRepairOrderListByOperator(params) {
  return requestUrl({
    url: `${BASE_URL}/weChatInfo/getRepairOrderListByOperator`,
    data: params,
    method: 'POST'
  })
}

/**
 * @function 维修工单暂存或提交
 * @param {*} params
 * @return {*}
 */
export function maintainStagingSaveWorkOrder(params) {
  return requestUrl({
    url: `${BASE_URL}/weChatInfo/maintainStagingSaveWorkOrder`,
    data: params,
    method: 'POST'
  })
}

export function getFactoryTypeList() {
  return requestUrl({
    url: `${BASE_URL}/factoryInfo/findList`,
    data: {},
    method: 'POST'
  })
}

export function getCodeImg() {
  return requestUrl({
    url: `${BASE_URL}/qauth/captchaImage`,
    data: {},
    method: 'get'
  })
}

export function resetUserPassword(data) {
  return requestUrl({
    url: `${BASE_URL}/weChatInfo/resetOperatorPassword`,
    data,
    method: 'POST'
  })
}

export function findNoticeList(data) {
  return requestUrl({
    url: `${BASE_URL}/notice/findPageList`,
    data,
    method: 'POST'
  })
}

export function findKnowledgeList(data) {
  return requestUrl({
    url: `${BASE_URL}/knowledge/findPageList`,
    data,
    method: 'POST'
  })
}

export function findCurAlarmPageList(data) {
  return requestUrl({
    url: `${BASE_URL}/curAlarm/findCurAlarmPageList`,
    data,
    method: 'POST'
  })
}
export function findCalarmHisPageList(data) {
  return requestUrl({
    url: `${BASE_URL}/alarmHis/findCalarmHisPageList`,
    data,
    method: 'POST'
  })
}
export function findFaultInfoPageList(data) {
  return requestUrl({
    url: `${BASE_URL}/faultInfo/findFaultInfoPageList`,
    data,
    method: 'POST'
  })
}


/******************************忘记密码*************************************/
export function getCaptchaByPhoneNo(phone) {
  return requestUrl({
    url: `${BASE_URL}/weChatInfo/getCaptchaSms/${phone}`,
    method: 'GET'
  })
}
export function resetPassword(data) {
  return requestUrl({
    url: `${BASE_URL}/weChatInfo/resetPasswd`,
    data,
    method: 'PUT'
  })
}
export const UPLOAD_FILE_URL = `${BASE_URL}/weChatInfo/upload`

/******************************转单操作*************************************/
//获取操作人员列表
export function findOperationInfoList(data) {
  return requestUrl({
    url: `${BASE_URL}/operationInfo/findList`,
    data,
    method: "POST"
  });
}
//转单操作
export function deliverWorkOrder(data) {
  return requestUrl({
    url: `${BASE_URL}/workOrderInfo/transfer-order`,
    data,
    method: "PUT"
  });
}

//获取报警器厂家列表
export function getfactoryList() {
  return requestUrl({
    url: `${BASE_URL}/factoryInfo/findList`,
    data:{},
    method: "POST"
  });
}